﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using FlexCell;
using YArchitech.LIB;
using YArchitech.LIB.YJKControls;

namespace ModelChecking.ModelValidation.FireCompartment
{
	public partial class DlgDistanceRules : System.Windows.Forms.Form
	{
		public DlgDistanceRules(string inputDataPath = null)
		{
			this.InitializeComponent();
			string text = Product.InstallLocation + "\\Data\\DistanceRules.xml";
			if (inputDataPath != null)
			{
				text = Product.InstallLocation + inputDataPath;
				if (text.Contains("HAVC"))
				{
					base.Height = 200;
					this.btnCancel.Location = new Point(533, 130);
					this.gridRules.Height = 120;
					this.UpdataDpi();
				}
				else if (text.Contains("Drainage"))
				{
					base.Height = 400;
					this.btnCancel.Location = new Point(533, 335);
					this.gridRules.Height = 330;
					this.UpdataDpi();
				}
				else if (text.Contains("Electric"))
				{
					base.Height = 190;
					this.btnCancel.Location = new Point(533, 125);
					this.gridRules.Height = 120;
					this.UpdataDpi();
				}
			}
			this.gridRules.LoadFromXML(text);
		}

		private void UpdataDpi()
		{
			double num = 1.5;
			double num2 = 1.5;
			WinDPIManager.GetWinFormXYDpi(ref num, ref num2);
			base.Height = (int)(num2 * (double)base.Height);
			this.btnCancel.Location = new Point((int)(num * (double)this.btnCancel.Location.X), (int)(num2 * (double)this.btnCancel.Location.Y));
			this.gridRules.Height = (int)(num2 * (double)this.gridRules.Height);
		}
	}
}
